<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .bg {
            background: green;
        }
        
        .col {
            color: red;
        }
        
        .f30 {
            font-size: 30px;
        }
        
        .active {
            width: 200px;
            height: 200px;
            background: darkgreen;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- 对象写法 -->
        <div :class="{bg:bgflag,col:colflag}">你好</div>
        <!-- 数组写法 -->
        <div :class="[bstr,cstr]">你好</div>
        <!-- 三目运算符 -->
        <h1 :class="flag?'active':'bg'">三木加载央视</h1>
        <!-- <h1 :class="数据"></h1> -->
        <button @click="change">改变</button>
        <button @click="flag=!flag">改变</button>
        <!-- style -->
        <!-- 对象写法 -->
        <h1 :style="{width:width,height:height,background: 'red'}">你好</h1>
        <!-- 三目 -->
        <div :style="flag?objA:objB">HAHAH</div>
        <!-- 数组写法 -->
        <h1 :style="[objA,objB]"></h1>
    </div>
    <script src="./vue.js"></script>
    <script>
        new Vue({
            el: "#app",
            data() {
                return {
                    bgflag: false,
                    colflag: true,
                    bstr: "bg",
                    cstr: "col",
                    flag: false,
                    list: [],
                    width: "200px",
                    height: "200px",
                    objB: {
                        color: "red"
                    },
                    objA: {
                        width: window.innerWidth + "px",
                        height: window.innerHeight + "px",
                        background: "rgba(0,0,0,0.5)",
                        position: "absolute",
                        top: "0",
                        left: "0"
                    }
                }
            },
            methods: {
                change() {
                    // 改变vue的数据
                    this.bstr = "f30";
                }
            },
        })
    </script>
</body>

</html>